#include "server_socket.h"


int main()
{
	session s;
	
	int connfd = create_connect_socket("0.0.0.0", 8080); //连接服务端ip、port	
	init_socket_server(&s, connfd, STDIN_FILENO);
	
	printf("从屏幕输入内容：\n");
	
	while(1)
	{
		int type = server_wait(&s);
		switch(type)
		{
		case STDIN_DATA:
			//printf("[%s]\n", s.buf);
			server_send(&s);					//发送消息给服务端
			break;
		case SOCKET_DATA:
			server_recv(&s);					//接收来自服务端消息
			printf("recv: %s\n", s.buf);
			break;
		default:
			printf("error type:%d\n", type);	//错误处理...
			break;
		}
		
	}
	return 0;
}








